<?php
// +----------------------------------------------------------------------
// | [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Author < 931274989@qq.com >
// +----------------------------------------------------------------------
// | Explain 分销
// +----------------------------------------------------------------------
namespace app\admin\controller;

use think\Controller;
use think\Db;

class Fenxiao extends Controller
{
  public function seting()
  {
    $config = Db::name('fenxiao')->where('fenxiao','=','fenxiao')->find();
    $this->assign('config',$config);
    return view();
  }

  public function edit()
  {
    if($this->request->isPost()) {
      $post = $this->request->post();
      if(empty($post['status'])) {
        $post['status'] = 0;
      } else {
          $post['status'] = $post['status'];
      }
      $result = Db::name('fenxiao')->where('fenxiao','=','fenxiao')->update($post);
      if($result) {
        $this->success('提交成功','admin/fenxiao/seting');
      } else {
        $this->error('提交失败');
      }
    }
  }
  
}
?>